package javabasics.designpattern.decorator;

/**
 * @Author suxiaoxiao
 * @Date 2019/6/1 17:04
 * @Version 1.0
 */
public class PacketHTMLHeaderCreator extends PacketDecorator {

    public PacketHTMLHeaderCreator(IPacketCreator c) {
        super(c);
    }

    /**
     * 将给定的数据封装成html
     * @return
     */
    @Override
    public String handleContent() {
        StringBuffer sb = new StringBuffer();
        sb.append("<html>");
        sb.append("<body>");
        sb.append(component.handleContent());
        sb.append("</body>");
        sb.append("</html>\n");
        return sb.toString();
    }

}
